<?php

use Illuminate\Database\Seeder;
use App\Models\Shop;
use App\Models\ShopType;
use Faker\Generator as Faker;



class ShopsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run(Faker $faker)
    {

        $shopType = ShopType::get()->pluck('id')->toArray();

        $shop = factory(Shop::class)->times(600)->make()->each(function($query) use ($faker , $shopType){
            $query->shop_type_id = $faker->randomElement($shopType);
        });

        $shop_array = $shop->makeVisible(['password'])->toArray();
        Shop::insert($shop_array);

        $shop = Shop::find(1);
        $shop->name = 'shop345111';
        $shop->account = 'shop345111';
        $shop->save();

        //
    }
}
